<?php
namespace app\index\controller;

use think\Controller;

class Dingd extends Controller
{
    public function Dlist()
    {
        $page = request()->get( 'page',1 );
        $limit = request()->get( 'limit',5);

        $where = [];
        $res = model('Ddan1021') -> ListAll( $page,$limit,$where );

        if( !$res )
        {
            return json(array('code' => 1, 'msg' =>"错误!!!!", 'data' => ''));
        }

        return json(array('code' => 0, 'msg' =>"OK", 'data' => $res ));
    }

    public function DingAdd()
    {
        $data = request()->post();

        $res = model('Dt')->dtAdd( $data );

        if( !$res )
        {
            return json(array('code' => 1, 'msg' =>"成功", 'data' => ''));
        }

        return json(array('code' => 0, 'msg' =>"OK", 'data' => $res ));
    }


    public function Ds()
    {
        $page = request()->get( 'page',1 );
        $limit = request()->get( 'limit',5);

        $where = [];
        $res = model('Dt') -> ListAll( $page,$limit,$where );

        if( !$res )
        {
            return json(array('code' => 1, 'msg' =>"错误!!!!", 'data' => ''));
        }

        return json(array('code' => 0, 'msg' =>"OK", 'data' => $res ));
    }
}